package org.createModel.singleton.demo8;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Client {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class clazz = Singleton.class;
        Constructor constructor = clazz.getDeclaredConstructor();
        constructor.setAccessible(true);
        Singleton singleton = (Singleton)constructor.newInstance();
        System.out.println("创建了一个对象");
        Singleton singleton1 = (Singleton)constructor.newInstance();
        System.out.println(singleton == singleton1);
    }
}
